const Koa=require("koa");
const app=new Koa();
const views=require("koa-views");
const mongoose=require("mongoose");
const {resolve}=require("path")
const {connect,initSchemas}=require("./database/init");
;(async ()=>{
    await connect()
    initSchemas()
    // require('./tasks/movie')
    require('./tasks/api')

})()
app.use(views(resolve(__dirname,"./views"),{
    extension:"pug"
}))
app.use(async (ctx,next)=>{
   await ctx.render("index",{
       you:"Luck",
       me:"王宇翔"
   })
})

app.listen(4455)